let Url = location.href;
console.log(Url);
let arr = decodeURI(Url.split("?")[1]).split("&");

let obj = {};

for (let key in arr) {
  console.log(arr[key].split("="));
  obj[arr[key].split("=")[0]] = arr[key].split("=")[1];
}
console.log(obj);
let productid = obj.productId;
let productName = obj.productName;

//2.6.1、获取商品详情.............
$.get(
  "http://chst.vip:1234/api/getproduct",
  { productid },
  (res) => {
    let html = "";
    let body = "";
    $(res.result).each((i, item) => {
      console.log(res);
      html += `首页>电视>${item.productName.split(" ")[0]}`;
      body += `      <li>
      ${item.productImg}
      <div>
        <h3>
          <span class=>${item.productName}</span>

        </h3>
      
      </div>
    </li>`;
    });
    $(".contentbottom").text(html);
    $(".contenttop").html(body);
  },
  "json"
);
//2.6.1、获取商品评价.............
$.get(
  "http://chst.vip:1234/api/getproductcom",
  { productid },
  (res) => {
    let comtop = "";
    let comfoot = "";
    $(res.result).each((i, item) => {
      comfoot += `   <h3>
      <span>${item.comName}</span>
      <span>${item.comTime}</span>
    </h3> 
    <h4>
   ${item.comContent}
     
    </h4> 
    <h5>
    ${item.comFrom}
    </h5>
    
  `;
      console.log(item);
    });
    $(".contentfoot .addcomfoot").html(comfoot);
  },
  "json"
);
